﻿<UserControl x:Class="OI.Views.DatasetDetailsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro" 
    xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
    xmlns:ei="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" 
    xmlns:Media="clr-namespace:Microsoft.Expression.Interactivity.Media;assembly=Microsoft.Expression.Interactions" mc:Ignorable="d"
    d:DesignHeight="800" d:DesignWidth="800">

    <Grid Style="{StaticResource MainSubcontent}" >
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="360" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <StackPanel VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2">
            <!--TITLE-->
            <TextBlock  Name="Title" TextWrapping="Wrap" Style="{StaticResource PageTitle}"  Width="340" />

            <!--DETAILS-->
            <ItemsControl  Margin="24,0,0,0" ItemsSource="{Binding Items}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Vertical" Margin="0,0,0,6">
                            <TextBlock Text="{Binding Item1}" Style="{StaticResource SectionHeaders}" TextWrapping="Wrap" Opacity="0.66" />
                            <TextBlock Text="{Binding Item2}" Style="{StaticResource ListItems}" TextWrapping="Wrap" />
                        </StackPanel>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </StackPanel>

        <!--MENU-->
        <ItemsControl Name="MainMenu" Grid.Row="0" Grid.Column="1"
                      HorizontalAlignment="Right" VerticalAlignment="Bottom">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Grid Visibility="{Binding EnabledVisibility}">
                        <RadioButton Name="sel"
                                    Style="{StaticResource MenuRadioButton}"
                                    GroupName="SubMenuGroup" 
                                    IsChecked="{Binding IsSelected}"
                                    Width="{Binding Width}"
                                    Micro:Message.Attach="[Event Checked] = [Action MenuSelect($dataContext);]">
                        <RadioButton.Content>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Header}"
                                               VerticalAlignment="Top"
                                               HorizontalAlignment="Right" 
                                               Style="{StaticResource MainMenuItem}"
                                               FontSize="30"
                                               Width="Auto"/>
                            </StackPanel>
                        </RadioButton.Content>
                    </RadioButton>

                    <!--highlight-->
                    <TextBlock Name="hl" Text="{Binding Header}"
                                                    VerticalAlignment="Top"
                                                    HorizontalAlignment="Left"
                                                    Margin="4,1,0,0"
                                                    Style="{StaticResource MainMenuItem}"
                                                    FontSize="30"
                                                    Foreground="Transparent"
                                                    Width="Auto">
                            <TextBlock.Resources>
                                <Storyboard x:Key="HLOFF">
                                    <ColorAnimation Storyboard.TargetName="hl" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Duration="0" To="Transparent"/>
                                </Storyboard>
                                <Storyboard x:Key="HLON">
                                    <ColorAnimation Storyboard.TargetName="hl" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Duration="0" To="#40000000"/>
                                </Storyboard>
                            </TextBlock.Resources>
                                        
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="MouseEnter">
                                    <Media:ControlStoryboardAction Storyboard="{StaticResource HLON}"/>
                                </i:EventTrigger>
                                <i:EventTrigger EventName="MouseLeave">
                                    <Media:ControlStoryboardAction Storyboard="{StaticResource HLOFF}"/>
                                </i:EventTrigger>
                                    <i:EventTrigger EventName="MouseLeftButtonDown">
                                    <ei:ChangePropertyAction TargetName="sel" PropertyName="IsChecked" Value="True" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </TextBlock>
                    </Grid>
                </DataTemplate>
            </ItemsControl.ItemTemplate>

            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Controls:WrapPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
        
        <!--SUBCONTENT-->
        <ContentControl Name="ActiveItem"  Grid.Row="1" Grid.Column="1" 
                        Margin="8,0,0,0" 
                        HorizontalContentAlignment="Stretch" 
                        VerticalContentAlignment="Stretch"/>

    </Grid>
</UserControl>
